package net.hn.hnms.biz.safety.trinity.dao;

import net.hn.hnms.biz.safety.trinity.entity.HiddenDangerReform;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.List;

/**
 * @author 智呈物联 nzw
 * @date 2022/8/4
 */
@Repository
public interface HiddenDangerReformDao extends JpaRepository<HiddenDangerReform,String> {

    /**
     * 查询今天整改的隐患
     * @param timestamp /今天时间信息
     * @return
     */
    @Query(value = "SELECT\n" +
            "\t* \n" +
            "FROM\n" +
            "\thidden_danger_reform\n" +
            "WHERE\n" +
            "\treform_date >= ?",nativeQuery = true)
    List<HiddenDangerReform> findAllDataTime(Timestamp timestamp);

    @Query(value = "SELECT COUNT\n" +
            "\t( * ) \n" +
            "FROM\n" +
            "\thidden_danger_reform",nativeQuery = true)
    int countAll();
}
